﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ClientControllers;

namespace WilkeGruppe4
{
    /// <summary>
    /// Interaction logic for PasswordWindow.xaml
    /// </summary>
    public partial class PasswordWindow : Window
    {
        Cls_Controller systemController;
        MainWindow mw;

        public PasswordWindow(MainWindow mw, Cls_Controller systemController)
        {
            this.mw = mw;
            this.systemController = systemController;
            InitializeComponent();
            txtPassword.Focus();

            systemController.HideTaskBar();
        }

        private void btnGo_Click(object sender, RoutedEventArgs e)
        {
            if (mw.CheckPassword(txtPassword.Password))
            {
                systemController.ShowTaskBar();
                systemController.UnblockProcesses();

                this.Close();
            }
            else
            {
                txtPassword.Password = "";
                txtPassword.Focus();
            }
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            
        }       
    }
}
